CC:=gcc
log:=thirdparty/log/log.c thirdparty/log/log.h
log_test: test/log_test.c $(log)
	-$(CC) $^ -o $@ -Ithirdparty
	-./$@
	-rm $@

app_com :=app/app_com.c app/app_com.h
app_com_test: test/app_com_test.c $(log) $(app_com)
	-$(CC) $^ -o $@ -Iapp -Ithirdparty
	-./$@
	-rm $@

app_buffer:=app/app_buffer.h app/app_buffer.c
app_buffer_test: test/app_buffer_test.c $(app_buffer) $(log)
	-$(CC) $^ -o $@ -Ithirdparty -Iapp
	-./$@
	-rm $@

cjson:=thirdparty/cJSON/cJSON.c thirdparty/cJSON/cJSON.h
cjson_test: test/cjson_test.c $(cjson) $(log)
	-$(CC) $^ -o $@ -Ithirdparty
	-./$@
	-rm $@

app_message:=app/app_message.h app/app_message.c
app_message_test: test/app_message_test.c $(app_message) $(log) $(cjson)
	-$(CC) $^ -o $@ -Ithirdparty -Iapp
	-./$@
	-rm $@
mqtt_test: test/mqtt_test.c
	-$(CC) $^ -o $@ -lpaho-mqtt3c
	-./$@
	-rm $@
app_mqtt:=app/app_mqtt.h app/app_mqtt.c
app_mqtt_test: test/app_mqtt_test.c $(app_mqtt) $(log) 
	-$(CC) $^ -o $@ -Ithirdparty -Iapp -lpaho-mqtt3c
	-./$@
	-rm $@
